package com.web.action;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import com.mysql.jdbc.StringUtils;
import com.web.action.res.Response;
import com.web.action.res.ResponseData;
import com.web.common.Sys;
import com.web.model.PageBean;
import com.web.model.TCathectic;
import com.web.model.TDict;
import com.web.model.TUser;
import com.web.model.TUserBalanceRecord;
import com.web.model.TWinNum;
import com.web.model.UserAmt;
import com.web.model.constant.Constant;
import com.web.service.TCathecticService;
import com.web.service.TConfigService;
import com.web.service.TUserBalanceRecordService;
import com.web.service.TUserService;
import com.web.service.TWinNumService;
import com.web.utils.MD5;
import com.web.utils.WebUtil;

/**
 * @title:ManageAction
 * @Description:管理后台等功能
 * @email 223450427@qq.com
 * @author Administrator
 * @date Nov 23, 2016 11:09:45 PM
 */
@Controller
@RequestMapping("manage")
public class ManageAction {

	@Autowired
	private TUserService userService;

	@Autowired
	private TConfigService tConfigService;

	@Autowired
	private TUserBalanceRecordService userBalanceRecordService;

	@Autowired
	private TCathecticService catecticService;

	@Autowired
	private TWinNumService winNumService;

	@Resource(name = "sys")
	private Sys sys;

	private static SimpleDateFormat dayFmarter = new SimpleDateFormat("yyyy-MM-dd");

	/* 管理首页 */
	@RequestMapping(value = "index", method = RequestMethod.GET)
	public String toAddUser(HttpSession session) {
		TUser sessionUser = (TUser) session.getAttribute(Constant.SESSION_USER);
		if (sessionUser == null) {
			return "/manage/login";
		}
		return "manage/index";
	}

	/* 代理页面 */
	@RequestMapping(value = "/login", method = RequestMethod.GET)
	public ModelAndView loginJsp(HttpServletRequest request, HttpSession session) {
		ModelAndView mv = new ModelAndView();
		// 校验是否合法来源
		String token = (String) session.getAttribute(Constant.SESSION_TOKEN);
		if (WebUtil.isEmpty(token)) {
			mv.setViewName("redirect:/index");
		} else {
			mv.setViewName("/manage/login");
		}
		return mv;
	}

	/* 用户列表 */
	@RequestMapping("user_list")
	public String user_list(HttpServletRequest request, HttpSession session, Long userId, String userNo) {
		TUser sessionUser = (TUser) session.getAttribute(Constant.SESSION_USER);
		if (sessionUser == null) {
			return "/manage/login";
		}
		if (userId != null) {// 管理员查看代理下面的用户
			sessionUser = userService.selectByPrimaryKey(userId);
		} else {
			userId = sessionUser.getUserId();
		}
		if (sessionUser == null) {
			PageBean<TUser> userList = new PageBean<TUser>(new ArrayList<TUser>());
			request.setAttribute("userList", userList);
		} else {
			Map<String, Object> map = new HashMap<String, Object>();
			if (!StringUtils.isNullOrEmpty(userNo)) {
				map.put("userNo", userNo);
			}
			if (sessionUser.getRoleId() == 2) { // 代理
				map.put("parentUserId", sessionUser.getUserId());
				map.put("roleId", 3);
			} else if (sessionUser.getRoleId() == 3) { // 会员
				map.put("userId", sessionUser.getUserId());
				map.put("roleId", 3);
			} else if (sessionUser.getRoleId() == 1) {
				map.put("parentUserId", sessionUser.getUserId());
				map.put("roleId", 2);
			}
			String page = (request.getParameter("page") == null ? "1" : request.getParameter("page"));
			map.put("pageNum", Integer.parseInt(page));
			map.put("pageSize", 20);
			map.put("todayStart", dayFmarter.format(new Date()) + " 00:00:00");
			map.put("todayEnd", dayFmarter.format(new Date()) + " 23:59:59");

			PageBean<TUser> userList = userService.selectUserList(map);
			String url = "";
			if (!StringUtils.isNullOrEmpty(userNo)) {
				url = "/manage/user_list?userId=" + userId + "&userNo=" + userNo + "&page=";
			} else {
				url = "/manage/user_list?userId=" + userId + "&page=";
			}
			userList.setUrl(url);
			userList.getPageStr();
			request.setAttribute("userList", userList);
			request.setAttribute("roleId", sessionUser.getRoleId());
			request.setAttribute("userNo", userNo);
		}

		return "/manage/user_list";
	}

	/* 充值 */
	@RequestMapping("cz")
	public String cz(HttpServletRequest request, HttpSession session, Long userId) {
		TUser sessionUser = (TUser) session.getAttribute(Constant.SESSION_USER);
		if (sessionUser == null) {
			return "/manage/login";
		}
		// 实时查询出用户相关信息及余额
		TUser user = userService.selectByPrimaryKey(userId);
		if (user == null) {
			return "/manage/login";
		}
		request.setAttribute("user", user);
		return "/manage/user_cz";
	}

	/* 扣款 */
	@RequestMapping("kk")
	public String kk(HttpServletRequest request, HttpSession session, Long userId) {
		TUser sessionUser = (TUser) session.getAttribute(Constant.SESSION_USER);
		if (sessionUser == null) {
			return "/manage/login";
		}
		// 实时查询出用户相关信息及余额
		TUser user = userService.selectByPrimaryKey(userId);
		if (user == null) {
			return "/manage/login";
		}
		request.setAttribute("user", user);
		return "/manage/user_kk";
	}

	/* 禁用帐号 */
	@RequestMapping(value = "/limit_user", method = RequestMethod.POST)
	@ResponseBody
	public Response limit_user(TUser user, String captcha, HttpServletRequest request, HttpSession session) {
		Response res = new Response();
		if (user.getUserId() == null) {
			return res.ParamError;
		}

		TUser u = (TUser) session.getAttribute(Constant.SESSION_USER);
		// 非管理员
		if (u.getRoleId() == null || u.getRoleId().longValue() == 3) {
			res.setResultCode("5");
			res.setMsg("该操作没有权限获取数据");
			return res;
		}

		// 修改用户登录信息
		TUser userParam = new TUser();
		userParam.setIp(WebUtil.getRealIp(request));
		userParam.setLastLoginTime(WebUtil.getDateTimestamp());
		userParam.setUserId(user.getUserId());
		userParam.setUserStatus(0l);
		userService.updateByPrimaryKey(userParam);

		// 如果是管理员 需要把下面所有的帐号禁用
		if (u.getRoleId() != null && u.getRoleId().longValue() == 1) {
			userService.updateAllUserByParent(user.getUserId());
		}
		return res.SUCC;
	}

	/* 使用帐号 */
	@RequestMapping(value = "/limit_user_ok", method = RequestMethod.POST)
	@ResponseBody
	public Response limit_user_ok(TUser user, String captcha, HttpServletRequest request, HttpSession session) {
		Response res = new Response();
		if (user.getUserId() == null) {
			return res.ParamError;
		}

		// 修改用户登录信息
		TUser userParam = new TUser();
		userParam.setIp(WebUtil.getRealIp(request));
		userParam.setLastLoginTime(WebUtil.getDateTimestamp());
		userParam.setUserId(user.getUserId());
		userParam.setUserStatus(1l);
		userService.updateByPrimaryKey(userParam);
		return res.SUCC;
	}

	/* 用户充值 */
	@RequestMapping(value = "/user_cz", method = RequestMethod.POST)
	@ResponseBody
	public Response userCz(TUser user, String captcha, HttpServletRequest request, HttpSession session) {

		TUser sessionUser = (TUser) session.getAttribute(Constant.SESSION_USER);
		Response res = new Response();
		if (user.getUserId() == null || user.getUserBalance() == null || sessionUser.getUserId() == null) {
			return res.ParamError;
		}
		if (sessionUser.getRoleId() == 3) {
			return res.FFQUCODE;
		}
		// 会员信息
		TUser u = userService.selectByPrimaryKey(user.getUserId());
		// 代理信息
		TUser dl = userService.selectByPrimaryKey(sessionUser.getUserId());

		if (u.getUserId() == null || dl.getUserId() == null) {
			return res.ParamError;
		}
		// 判断管理盘金额
		if (sessionUser.getRoleId() != 1) {
			if (dl.getUserBalance() < user.getUserBalance()) {
				return res.EDUCODE;
			}
		}
		// 修改用户登录信息
		u.setUserId(user.getUserId());
		u.setUserBalance(u.getUserBalance() + user.getUserBalance());
		u.setCreditAmt(u.getCreditAmt() + user.getUserBalance());// 信用金额每次充值递增
		userService.updateByPrimaryKey(u);

		if (sessionUser.getRoleId() != 1) {
			dl.setUserBalance(WebUtil.formartDouble(dl.getUserBalance() - user.getUserBalance(), 2));
			userService.updateByPrimaryKey(dl);

			sessionUser.setUserBalance(dl.getUserBalance());
			sessionUser.setPassword(null);
			userService.updateByPrimaryKey(sessionUser);
			session.setAttribute(Constant.SESSION_USER, sessionUser);
		}

		// 记录资金流转记录
		TUserBalanceRecord record = new TUserBalanceRecord();
		record.setBalance(user.getUserBalance());
		record.setBalanceDate(WebUtil.getDateTimestamp());
		record.setBalanceType(Constant.USER_BALANCE_TYPE_1);
		record.setOpterId(sessionUser.getUserId());
		record.setUserId(user.getUserId());
		record.setBalanceContext(Constant.getUserBalanceContext(Constant.USER_BALANCE_TYPE_1, null));
		userBalanceRecordService.insert(record);

		return res.SUCC;
	}

	/* 用户扣款 */
	@RequestMapping(value = "/user_kk", method = RequestMethod.POST)
	@ResponseBody
	public Response userKK(TUser user, String captcha, HttpServletRequest request, HttpSession session) {

		TUser sessionUser = (TUser) session.getAttribute(Constant.SESSION_USER);
		Response res = new Response();
		if (user.getUserId() == null || user.getUserBalance() == null || sessionUser.getUserId() == null) {
			return res.ParamError;
		}
		if (sessionUser.getRoleId() == 3) {
			return res.FFQUCODE;
		}
		// 会员信息
		TUser u = userService.selectByPrimaryKey(user.getUserId());
		// 代理信息
		TUser dl = userService.selectByPrimaryKey(sessionUser.getUserId());

		if (u.getUserId() == null || dl.getUserId() == null) {
			return res.ParamError;
		}
		// 判断用户金额
		if (u.getUserBalance() < user.getUserBalance()) {
			return res.UserBalanceNotEnough;
		}

		// 修改代理账户
		dl.setUserId(dl.getUserId());
		dl.setUserBalance(dl.getUserBalance() + user.getUserBalance());
		userService.updateByPrimaryKey(dl);

		u.setUserBalance(u.getUserBalance() - user.getUserBalance());
		u.setCreditAmt(u.getCreditAmt() - user.getUserBalance());
		if (u.getCreditAmt() < 0) {
			u.setCreditAmt(0.0);
		}
		userService.updateByPrimaryKey(u);

		sessionUser.setUserBalance(dl.getUserBalance());
		sessionUser.setPassword(null);
		session.setAttribute(Constant.SESSION_USER, sessionUser);

		// 记录资金流转记录
		TUserBalanceRecord record = new TUserBalanceRecord();
		record.setBalance(0 - user.getUserBalance());
		record.setBalanceDate(WebUtil.getDateTimestamp());
		record.setBalanceType(Constant.USER_BALANCE_TYPE_4);
		record.setBalanceContext(Constant.getUserBalanceContext(Constant.USER_BALANCE_TYPE_4, null));
		record.setOpterId(sessionUser.getUserId());
		record.setUserId(user.getUserId());
		record.setBalanceContext(Constant.getUserBalanceContext(Constant.USER_BALANCE_TYPE_4, null));
		userBalanceRecordService.insert(record);

		return res.SUCC;
	}

	/* 个人账户历史 */
	@RequestMapping(value = "select_list", method = RequestMethod.GET)
	public String select_list(Long userId, HttpServletRequest request, HttpServletResponse response,
			HttpSession session) {
		TUser sessionUser = (TUser) session.getAttribute(Constant.SESSION_USER);
		if (sessionUser == null) {
			return "/manage/login";
		} else if (sessionUser.getRoleId() == 1 || sessionUser.getRoleId() == 2) {
			String today = dayFmarter.format(new Date());
			Map<String, Object> param = new HashMap<String, Object>();
			param.put("todayStart", today + " 00:00:00");
			param.put("todayEnd", today + "23:59:59");
			param.put("userId", userId);
			String page = (request.getParameter("page") == null ? "1" : request.getParameter("page"));
			param.put("pageNum", Integer.parseInt(page));
			param.put("pageSize", 10);
			PageBean<TUserBalanceRecord> pageBean = userBalanceRecordService.selectUserBalacneList(param);
			pageBean.setUrl("/manage/select_list?page=");
			pageBean.getPageStr();
			request.setAttribute("pageBean", pageBean);
			return "/manage/user_history";
		} else {
			return "login";
		}
	}

	/* 修改密码 */
	@RequestMapping(value = "password", method = RequestMethod.GET)
	public String password(HttpSession session) {
		TUser sessionUser = (TUser) session.getAttribute(Constant.SESSION_USER);
		if (sessionUser == null) {
			return "/manage/login";
		}
		return "/manage/password";
	}

	/* 管理或者代理修改密码 */
	@RequestMapping(value = "auth_password", method = RequestMethod.GET)
	public String auth_password(HttpSession session, HttpServletRequest request, Long userId) {
		TUser sessionUser = (TUser) session.getAttribute(Constant.SESSION_USER);
		if (sessionUser == null) {
			return "/manage/login";
		}
		if (userId == null) {
			return "redirect:/manage/user_list";
		}
		TUser u = userService.selectByPrimaryKey(userId);
		if (sessionUser.getRoleId() == 2) {
			if (sessionUser.getUserId().longValue() != u.getParentUserId().longValue()) {
				return "redirect:/manage/user_list";
			}
		}
		request.setAttribute("user", u);
		return "/manage/auth_update";
	}

	/* 管理员或者代理修改密码 */
	@RequestMapping("update_user")
	@ResponseBody
	public Response updateUser(TUser user, HttpServletRequest request) {
		Response res = new Response();
		TUser u = (TUser) request.getSession().getAttribute(Constant.SESSION_USER);
		if (u == null || user.getUserId() == null) {
			return res.TokenInvalid;
		}
		if (StringUtils.isNullOrEmpty(user.getPassword())) {
			return res.ParamError;
		}
		user.setUserId(user.getUserId());
		user.setPassword(MD5.encode(user.getPassword()));
		userService.updateByPrimaryKey(user);
		return res.SUCC;
	}

	/**
	 * 两周情况
	 * 
	 * @param request
	 * @param response
	 * @return
	 * @throws ParseException
	 */
	@RequestMapping(value = "double_week", method = RequestMethod.GET)
	public String cathecticHistory(Long userId, HttpServletRequest request, HttpServletResponse response,
			HttpSession session) throws ParseException {
		List<TCathectic> resultList = new ArrayList<TCathectic>();
		TUser sessionUser = (TUser) session.getAttribute(Constant.SESSION_USER);
		if (sessionUser == null) {
			return "login";
		}
		TUser u = userService.selectByPrimaryKey(userId);
		List<TCathectic> cathecticList;
		if (u == null
				|| (!u.getParentUserId().equals(sessionUser.getUserId().longValue()) && sessionUser.getRoleId() != 1)) {
			request.setAttribute("cathecticList", resultList);
			cathecticList = new ArrayList<TCathectic>();
		} else {
			Map<String, Object> param = new HashMap<String, Object>();
			param.put("createUser", userId);
			Calendar cal = Calendar.getInstance();
			param.put("endDate", dayFmarter.format(cal.getTime()) + " 23:59:59");
			param.put("startDate", dayFmarter.format(WebUtil.getLastWeekMonday(new Date())) + " 00:00:00");
			cathecticList = catecticService.selectCatheticByDay(param);
		}

		Map<String, String> dateMap = WebUtil.getWeekdays(new Date());
		Set<String> dateSet = dateMap.keySet();
		TCathectic ca;
		boolean hasData = false;
		for (String s : dateSet) {
			hasData = false;
			for (TCathectic c : cathecticList) {
				if (dayFmarter.format(c.getCreateTime()).equals(s)) {
					c.setDateTime(dateMap.get(s));
					resultList.add(c);
					hasData = true;
					break;
				}
			}
			if (!hasData) {
				ca = new TCathectic();
				ca.setDateTime(dateMap.get(s));
				ca.setCathecticInt(0l);
				ca.setWinAmt(0.0);
				ca.setDayCount(0);
				ca.setCreateTime(dayFmarter.parse(s));
				resultList.add(ca);
			}
		}
		Collections.sort(resultList);
		request.setAttribute("cathecticList", resultList);
		return "manage/double_week";
	}

	/* 修改安全码 */
	@RequestMapping(value = "updat_code", method = RequestMethod.GET)
	public String updat_code(HttpSession session) {
		TUser sessionUser = (TUser) session.getAttribute(Constant.SESSION_USER);
		if (sessionUser == null) {
			return "/manage/login";
		} else if (sessionUser.getRoleId().longValue() != 1) {
			return "/manage/login";
		}
		return "/manage/update_code";
	}

	/* post提交修改 */
	@RequestMapping(value = "/updat_code", method = RequestMethod.POST)
	@ResponseBody
	public Response updat_code(HttpServletRequest request, String code, HttpSession session) {
		Response res = new Response();
		TUser u = (TUser) session.getAttribute(Constant.SESSION_USER);
		if (u == null || u.getRoleId().longValue() != 1 || code == null || "".equals(code)) {
			return res.TokenInvalid;
		}
		tConfigService.updateConfig(code);
		return res.SUCC;
	}

	/* 手工开奖 */
	@RequestMapping(value = "kj", method = RequestMethod.GET)
	public String kj(HttpSession session) {
		TUser sessionUser = (TUser) session.getAttribute(Constant.SESSION_USER);
		if (sessionUser == null) {
			return "/manage/login";
		} else if (sessionUser.getRoleId().longValue() != 1) {
			return "/manage/login";
		}
		return "/manage/kj";
	}

	/* 当前月会员投注情况 */
	@RequestMapping("month")
	public String month(HttpServletRequest request, HttpSession session, Long userId, String userNo) {
		TUser sessionUser = (TUser) session.getAttribute(Constant.SESSION_USER);
		// 未登录
		if (sessionUser == null) {
			return "/manage/login";
		}
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("beginTime", "2016-12-01");
		map.put("endTime", "2016-12-27");
		if (sessionUser.getRoleId().longValue() == 1) { // 管理员

		}
		if (sessionUser.getRoleId().longValue() == 2) { // 代理
			map.put("roleId", "2");
			map.put("userId", sessionUser.getUserId());
		}
		List<TCathectic> winList = catecticService.selectCatheticByMonth(map);
		request.setAttribute("winList", winList);
		return "/manage/month";
	}

	/* 实时投注查看 */
	@RequestMapping("play")
	public String play(HttpServletRequest request, HttpSession session) {
		TUser sessionUser = (TUser) session.getAttribute(Constant.SESSION_USER);
		String time = WebUtil.getDateTime(Constant.DATA_STR);
		request.setAttribute("time", time);
		// 未登录
		if (sessionUser == null) {
			return "/manage/login";
		}
		if (sessionUser.getRoleId().longValue() == 1) { // 管理员
			return "/manage/play";
		}
		return "/manage/index";
	}

	/* 管理员实时查看下注情况 */
	@RequestMapping("cathectic")
	@ResponseBody
	public ResponseData<TCathectic> cathectic(HttpServletRequest request, HttpSession session, String page) {
		ResponseData<TCathectic> res = new ResponseData<TCathectic>();
		try {
			TUser u = (TUser) request.getSession().getAttribute(Constant.SESSION_USER);
			// 用户未登录
			if (u == null) {
				res.setResultCode("5");
				res.setMsg("用户登录失效，请重新登录");
				return res;
			}
			// 非管理员
			if (u.getRoleId() == null || u.getRoleId().longValue() != 1) {
				res.setResultCode("6");
				res.setMsg("该操作没有权限获取数据");
				return res;
			}
			page = (request.getParameter("page") == null ? "1" : request.getParameter("page"));
			Map<String, Object> param = new HashMap<String, Object>();
			param.put("pageNum", Integer.parseInt(page));
			param.put("pageSize", 30);
			PageBean<TCathectic> pageBean = catecticService.selectListByPage(param);

			List<TCathectic> cathecticList = pageBean.getList();

			if (cathecticList == null || cathecticList.size() == 0) {
				res.setResultCode("5");
				res.setMsg("没有数据");
				return res;
			}

			TDict dict = null;
			for (TCathectic cathectic : cathecticList) {
				dict = sys.getDict(cathectic.getCathecticType() + "-" + cathectic.getCathecticCode());
				cathectic.setCathecticCodeStr(dict.getDictName());
			}
			res.setDataList(cathecticList);
			return res;
		} catch (Exception e) {
			e.printStackTrace();
			res.setResultCode("5");
			res.setMsg("系统出现异常，请重试");
			return res;
		}
	}

	/* 开奖结果最近50期 */
	@RequestMapping("result")
	public String result(HttpServletRequest request, HttpSession session) {
		TUser sessionUser = (TUser) session.getAttribute(Constant.SESSION_USER);
		// 未登录
		if (sessionUser == null) {
			return "/manage/login";
		}
		if (sessionUser.getRoleId().longValue() == 1 || sessionUser.getRoleId().longValue() == 2) { // 管理员或者代理
			return "/manage/result";
		}
		return "/manage/index";
	}

	/* ajax请求获取最近50期数据 */
	@RequestMapping(value = "win_list", method = RequestMethod.GET)
	@ResponseBody
	public ResponseData<TWinNum> win_list(HttpServletRequest request, HttpSession session) {
		ResponseData<TWinNum> res = new ResponseData<TWinNum>();
		try {

			TUser u = (TUser) session.getAttribute(Constant.SESSION_USER);
			// 登陆校验
			if (u == null) {
				res.setResultCode("5");
				res.setMsg("用户登录失效，请重新登录");
				return res;
			}
			// 会员没有权限调用
			if (u.getRoleId() == null || u.getRoleId().longValue() == 3) {
				res.setResultCode("6");
				res.setMsg("该请求没有权限");
				return res;
			}
			// 获取今天日期
			// String date = WebUtil.getStringDate(WebUtil.getDateTimestamp(),
			// Constant.DATA);

			Map<String, Object> param = new HashMap<String, Object>();
			param.put("pageNum", 1);
			param.put("pageSize", 30);
			param.put("sort", "create_time");
			PageBean<TWinNum> pageBean = winNumService.selectListByPage(param);

			List<TWinNum> winList = pageBean.getList();
			if (winList == null || winList.size() == 0) {
				res.setResultCode("7");
				res.setMsg("没有数据");
				return res;
			}
			res.setDataList(winList);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return res;
	}

	/* 游戏规则 */
	@RequestMapping("rule")
	public String rule(HttpServletRequest request, HttpSession session) {
		TUser sessionUser = (TUser) session.getAttribute(Constant.SESSION_USER);
		// 未登录
		if (sessionUser == null) {
			return "/manage/login";
		}
		if (sessionUser.getRoleId().longValue() == 1 || sessionUser.getRoleId().longValue() == 2) { // 管理员或者代理
			return "/manage/rule";
		}
		return "/manage/index";
	}

	/* 统计情况 */
	@RequestMapping("amt")
	public String amt(HttpServletRequest request, HttpSession session, UserAmt amt) {
		TUser sessionUser = (TUser) session.getAttribute(Constant.SESSION_USER);
		// 未登录
		if (sessionUser == null) {
			return "/manage/login";
		}
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("beginTime", "2016-12-01");
		map.put("endTime", "2016-12-27");
		List<UserAmt> winList = catecticService.findUserAmtList(amt);
		request.setAttribute("winList", winList);
		return "/manage/amt";
	}
}
